<template>
  <div id="content">
    <h2>{{ list.title }}</h2>
    <div v-html="list.content"></div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    var aid = this.$route.query.id; //获取新闻编号
    this.requestData(aid); //请求调用的数据
  },
  methods: {
    requestData(aid) {
      var that = this;
      this.$http
        .get(
          "http://www.phonegap100.com/appapi.php?a=getPortalArticle&aid=" + aid
        )
        .then(function(res) {
          console.log(res);
          that.list = res.data.result[0];
        })
        .catch(function(err) {
          console.log(err);
        });
    },
  },
};
</script>

<style type="text/css">
#content {
  text-align: left;
  line-height: 2;
  padding: 10px;
  border: 1px dotted lightgray;
  border-radius: 5px;
  margin-top: 5px;
}
img {
  max-width: 100%;
}
</style>
